<!DOCTYPE html>
<html>
    <head>
        <title>CSS Regions OM Test: NamedFlow with no regions</title>
        <link rel="author" title="Alan Stearns" href="mailto:stearns@adobe.com">
        <link rel="help" href="http://www.w3.org/TR/css3-regions/#the-namedflow-interface">
        <meta name="flags" content="dom">
        <meta name="assert" content="The NamedFlow interface works with no region chain.">
        <script src="/resources/testharness.js"></script>
        <script src="/resources/testharnessreport.js"></script>        
    </head>
    
    <style type="text/css">
        #flow1 {
            -webkit-flow-into: flow1; /*TEMP*/
            flow-into: flow1;
        }
    </style>
    <body>
        <div id="log"></div>

        <div id="flow1">foo</div>
        
        <script type="text/javascript">
            function testNameAttribute(flow_name) {
                var namedFlow = document.webkitGetFlowByName(flow_name);
                assert_equals (namedFlow.name, flow_name, 
                    "The name attribute should match the flow name.");
            }

            function testOversetAttribute(flow_name) {
                var namedFlow = document.webkitGetFlowByName(flow_name);
                assert_equals (namedFlow.overset, true, 
                    "The overset attribute should be true for a flow with an empty region chain.");
            }

            function testGetRegions(flow_name) {
                var namedFlow = document.webkitGetFlowByName(flow_name);
                assert_equals (namedFlow.getRegions(), [], 
                    "The getRegions method should return an empty sequence for a flow with an empty region chain.");
            }

            function testfirstEmptyRegionIndexAttribute(flow_name) {
                var namedFlow = document.webkitGetFlowByName(flow_name);
                assert_equals (namedFlow.firstEmptyRegionIndex, -1, 
                    "The firstEmptyRegionIndex attribute should return -1 for a flow with an empty region chain.");
            }

            function testgetContent(flow_name) {
                var namedFlow = document.webkitGetFlowByName(flow_name);
                var flowContent = document.getElementById (flow_name);

                assert_equals (namedFlow.getContent()[0], flowContent, 
                    "For a single-element named flow, getContent should return a NodeList containing the Element");
            }

            function testGetRegionsByContent(flow_name) {
                var namedFlow = document.webkitGetFlowByName(flow_name);
                var flowContent = document.getElementById (flow_name);
                assert_equals (namedFlow.getRegionsByContent(flowContent), [], 
                    "The getRegionsByContent method should return an empty sequence for a flow with an empty region chain.");
            }

            test( function() {testNameAttribute("flow1");},
                "Test name attribute."); 
            test( function() {testOversetAttribute("flow1");},
                "Test overset attribute."); 
            test( function() {testGetRegions("flow1");},
                "Test getRegions method."); 
            test( function() {testfirstEmptyRegionIndexAttribute("flow1");},
                "Test firstEmptyRegionIndex attribute."); 
            test( function() {testgetContent("flow1");},
                "Test getContent method."); 
            test( function() {testGetRegionsByContent("flow1");},
                "Test getRegionsByContent method."); 
        </script>
    </body>
</html>